package com.mengtian_tech.smart_lab.controller.console.common;

import java.util.Enumeration;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 通用的，输入内容的对话框
 * @author 王旭东
 *
 */
@Controller
@RequestMapping("commonInputController")
public class CommonInputContentController {
	
	/**
	 * 显示页面内容
	 * @return
	 */
	@RequestMapping(params="show")
	public String show(HttpServletRequest req){
		String id = req.getParameter("id");
		String postURL = req.getParameter("postURL");
		String title = req.getParameter("title");
		
		req.setAttribute("id", id);
		req.setAttribute("title",title);
		
		
		StringBuffer reqParams = new StringBuffer();
		Enumeration<String> enumeration =  req.getParameterNames();
		while(enumeration.hasMoreElements()){
			String reqName = enumeration.nextElement();
			
			if("id".equals(reqName)) continue;
			if("postURL".equals(reqName)) continue;
			if("title".equals(reqName)) continue;
			
			String value = req.getParameter(reqName);
			reqParams.append(reqName+"="+value+"&");
		}
		req.setAttribute("postURL", postURL+"&"+reqParams.toString());
		
		return "com/mengtian_tech/smart_lab/common/inputcontent";
	}
}
